﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;

using Tradex;
using Tradex.Messages;

namespace Tradex.Connectivity {

    /// <summary>
    /// The IConnectorTarget interface is the interface used by the ConnectorName (i.e. a Wrapper instance)
    /// to submit messages to the control server. It contains only very few methods as the actual payload actions
    /// are all handled via messages. As such, it mostly submits messages to the control server.
    /// </summary>
    [ServiceContract(SessionMode = SessionMode.Allowed)]
    public interface IConnectivityApi {

        /// <summary>
        /// Submits the next block of pending messages.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="cycle"></param>
        /// <param name="messages"></param>
        [OperationContract()]
        void SubmitMessages(string key, Guid cycle, Message[] messages);

        /// <summary>
        /// Reports data on the connector status and operations.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="cycle"></param>
        /// <param name="info"></param>
        /// <param name="update"></param>
        /// <param name="status"></param>
        [OperationContract ()]
        void SubmitConnectorData(string key, Guid cycle, ConnectionInfo info, ConnectionUpdate update, ConnectionStatus status);

        /// <summary>
        /// Reports a status change.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="code"></param>
        /// <param name="message"></param>
        [OperationContract ()]
        void SubmitStatusChange(string key, ConnectionStatusCode code, string message);
    }

}
